package iterator;

import java.util.Iterator;

/**
 * @ClassName Floor
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/2/22 14:50
 * @Version 1.0
 */
public class Floor implements Aggregate {

	private Room[] rooms;
	private int last = 0;

	public Floor(int size) {
		this.rooms = new Room[size];
	}

	public Room getRoom(int index) {
		return rooms[index];
	}

	public void AddRoom(Room room) {
		this.rooms[last] = room;
		last++;
	}

	public int getLength() {
		return last;
	}

	@Override
	public Iterator iterator() {
		return new FloorIterator(this);
	}
}
